<%@ include file="inc/header.jspf" %>

<script type="text/javascript">
	function del() {
		if (confirm('Are you sure?'))
			location.href = '../delete/${post.postNo}';
	}
</script>

<script type="text/javascript">
	if ('${post.postNo}' == '0') {
		alert('It doesn\'t exist');
		history.go(-1);
	}
</script>

<form:form modelAttribute="post">
	<fieldset>
		<ul data-role="listview" data-inset="true">
			<li data-role="fieldcontain">
				<form:label path="postNo"><fmt:message key="no"/></form:label>
				<form:input path="postNo" readOnly="yes" />
			</li>
			<li data-role="fieldcontain">
				<form:label path="category.name"><fmt:message key="category"/></form:label>
				<form:input path="category.name" readOnly="yes" />
			</li>
			<li data-role="fieldcontain">
				<form:label path="title"><fmt:message key="title"/></form:label>
				<form:input path="title" readOnly="yes" />
			</li>
			<li data-role="fieldcontain">
				<form:label path="content"><fmt:message key="content"/></form:label>
				<form:textarea path="content" readOnly="yes"/>
			</li>
			<li data-role="fieldcontain">
				<form:label path="tags"><fmt:message key="tag"/></form:label>	
				<form:input path="tags" readOnly="yes" />
			</li>
		</ul>
	</fieldset>
	
	<fieldset style="text-align: right;">
		<div style="float: left;">
			<button type="button" data-theme="b" data-inline="true" data-icon="bars" onclick="location.href = '../search?category=${post.category.categoryID}';"><fmt:message key="list"/></button>
			<button type="button" data-theme="b" data-inline="true" data-icon="arrow-u" onclick="location.href = '../detail/before/${post.postNo}';"><fmt:message key="up"/></button>
			<button type="button" data-theme="b" data-inline="true" data-icon="arrow-d" onclick="location.href = '../detail/after/${post.postNo}';"><fmt:message key="down"/></button>
		</div>
		<div style="float: right;">
			<button type="button" data-theme="b" data-inline="true" data-icon="plus" onclick="location.href = '../create?category=${post.category.categoryID}';"><fmt:message key="create"/></button>
			<button type="button" data-theme="b" data-inline="true" data-icon="edit" onclick="location.href = '../modify/${post.postNo}';"><fmt:message key="modify"/></button>
			<button type="button" data-theme="b" data-inline="true" data-icon="minus" onclick="del();"><fmt:message key="delete"/></button>
		</div>	
	</fieldset>
</form:form>

<%@ include file="inc/footer.jspf" %>